package demo;

public class StrBuilder {
    public static void main(String[] args) {
        StringBuilder sb1=new StringBuilder("hello");
        StringBuilder sb2=sb1;
        sb1.append(' ');
        sb1.append("world！");
        System.out.println(sb1);
        System.out.println(sb1.charAt(6));
        System.out.println(sb1.capacity());//获取底层数组的的总容量大小
        sb1.setCharAt(0,'H');
        System.out.println(sb1);
        sb1.deleteCharAt(0);
        System.out.println(sb1);
        sb1.delete(0,5);
        System.out.println(sb1);
        String str=sb1.substring(0,5);
        sb1.reverse();//字符串逆转
        String str2=sb1.toString();//StringBuilder转变为String
    }
}
